package cn.edu.sgu.www.mhxysy.service.xingyin.impl;

import cn.edu.sgu.www.mhxysy.entity.xingyin.XingyinType;
import cn.edu.sgu.www.mhxysy.mapper.xingyin.XingyinTypeMapper;
import cn.edu.sgu.www.mhxysy.service.xingyin.XingyinTypeService;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @author 沐雨橙风ιε
 * @version 1.0
 */
@Service
public class XingyinTypeServiceImpl implements XingyinTypeService {

    private final XingyinTypeMapper xingyinTypeMapper;

    @Autowired
    public XingyinTypeServiceImpl(XingyinTypeMapper xingyinTypeMapper) {
        this.xingyinTypeMapper = xingyinTypeMapper;
    }

    @Override
    public List<XingyinType> selectAll() {
        QueryWrapper<XingyinType> queryWrapper = new QueryWrapper<>();

        queryWrapper.isNotNull("parent_id");

        return xingyinTypeMapper.selectList(queryWrapper);
    }

    @Override
    public XingyinType selectById(Integer id) {
        return xingyinTypeMapper.selectById(id);
    }

}